/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.core.preference;

import org.eclipse.jface.preference.ColorFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

import com.cea.papyrus.core.PapyrusPlugin;
import com.cea.papyrus.core.utils.Debug;

/**
 * Defines the Papyrus General preference page.
 */
public class PapyrusGeneralPreferencePage extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage {

	/** Debug channel */
	private final int channel = 205;

	/**
	 * The Constructor.
	 */
	public PapyrusGeneralPreferencePage() {
		super(GRID);
		setPreferenceStore(PapyrusPlugin.getDefault().getPreferenceStore());
		setDescription("General Papyrus Preferences");
	}

	/**
	 * {@inheritDoc}}
	 */
	public void init(IWorkbench workbench) {
	}

	/**
	 * @{inheritDoc}
	 */
	@Override
	protected void createFieldEditors() {
		Debug.debug(this,"createFieldEditor()", channel);
		// create field to display the level of validation	
		addField(new RadioGroupFieldEditor(
				ValidationPreferenceConstants.VALIDATION_LEVEL,
				"Level of validation of your models:",
				1,
				new String[][] { {"No validation", ValidationPreferenceConstants.NO_VALIDATION},
						{"validation low level (Errors)", ValidationPreferenceConstants.VALIDATION_LOW_LEVEL},
						{"Validation high level (Errors + warnings)", ValidationPreferenceConstants.VALIDATION_HIGH_LEVEL}
				}, getFieldEditorParent()));
		
		addField(new ColorFieldEditor(PreferenceConstants.P_INHERITED_ELEMENT_COLOR, 
				"Color of inherited elements", getFieldEditorParent()));
	}
}